# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem 1.0
PortGroup clang_dependency 1.0

name             OCPN_libarchive

categories       archivers
license          BSD
maintainers      {toby @tobypeterson} openmaintainer
description      functions for reading and writing streaming archives
long_description \
	Libarchive is a programming library that can create and \
	read several different streaming archive formats, including \
	most popular tar variants, several cpio formats, 7zip and rar. It can \
	also write shar archives.
platforms        darwin

version          3.5.2
revision         0

checksums        rmd160  7b8ef3e9fe2e606ef67f070ba428fa56640dc1e6 \
                 sha256  5f245bd5176bc5f67428eb0aa497e09979264a153a074d35416521a5b8e86189 \
                 size    7054934

homepage         https://libarchive.org/
master_sites     ${homepage}downloads/
distname         libarchive-3.5.2
 
depends_lib      port:bzip2 port:zlib port:libxml2 port:xz \
                 port:lzo2 port:libiconv \
                 port:lz4 port:zstd

patchfiles       patch-libarchive__archive_read_support_format_lha.c.diff

platform darwin 8 {
    patchfiles-append patch-libarchive-3.5-fix-tests-tiger.diff
}

depends_build    port:pkgconfig

configure.cflags-append     "-mmacosx-version-min=10.9"

configure.args   --enable-bsdtar=shared --enable-bsdcpio=shared \
                 --disable-silent-rules --without-nettle \
                 --without-openssl --with-lzo2 --with-zstd

post-destroot {
    xinstall -d ${destroot}${prefix}/libexec/${subport}
    foreach program [glob -tails -directory ${destroot}${prefix}/bin *] {
        ln -s ${prefix}/bin/${program} ${destroot}${prefix}/libexec/${subport}
    }
}

test.run yes
test.target check

livecheck.type  regex
livecheck.regex libarchive-(\[0-9.\]+)\\.tar.gz
